ObjectPool

StockSharp.Xaml.Charting.Common.Helpers

Represents a pool of objects with a size limit.

Implements: IDisposable

Constructors

ObjectPool
public ObjectPool()
objectPool = ObjectPool()

Initializes a new instance of the ObjectPool class.

ObjectPool
public ObjectPool(int initAmount, Func<T, T> actionOnCreation)
objectPool = ObjectPool(initAmount, actionOnCreation)

Initializes a new instance of the ObjectPool class.

Properties

AvailableCount
public int AvailableCount { get; }
value = objectPool.AvailableCount

Gets the amount of pooled instances

Count
public int Count { get; }
value = objectPool.Count

Gets the summary amount of created instances

IsEmpty
public bool IsEmpty { get; }
value = objectPool.IsEmpty

Gets the value indicating whether current ObjectPool instance is empty.

Methods

Dispose
public void Dispose()
objectPool.Dispose()

Disposes of items in the pool that implement IDisposable.

Get
public T Get()
result = objectPool.Get()

Retrieves an item from the pool.

Returns: The item retrieved from the pool.

Get
public T Get(Func<T, T> actionOnCreation)
result = objectPool.Get(actionOnCreation)

Retrieves an item from the pool.

Returns: The item retrieved from the pool.

Get
public T Get(Func<T> actionOnCreation)
result = objectPool.Get(actionOnCreation)

Retrieves an item from the pool.

Returns: The item retrieved from the pool.

Put
public void Put(T item)
objectPool.Put(item)

Places an item in the pool.

item
The item to place to the pool.